#include<stdio.h>
#include<conio.h>
int main()
{
int a[10][10],b[10][10],c[10][10],m,i,j,n;
printf("Enter matrix dimension: ");
scanf("%d",&n);
for(m=0;m<2;m++)
{
printf("<======MATRIX %d======>\n",m+1);
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
printf("Enter value of row %d ",i+1);
printf("column %d of",j+1);
printf(" matrix %d : ",m+1);
switch(m)
{
case 0:
scanf("%d",&a[i][j]);
break;
case 1:
scanf("%d",&b[i][j]);
break;
default:
break;
}
}
}
}
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
c[i][j]=a[i][j]+b[i][j];
}
}
for(m=0;m<3;m++)
{
for(i=0;i<n;i++)
{
printf("[ ");
for(j=0;j<n;j++)
{
switch(m)
{
case 0:
printf("%d ",a[i][j]);
break;
case 1:
printf("%d ",b[i][j]);
break;
case 2:
printf("%d ",c[i][j]);
break;
default:
break;
}
}
printf("]\n");
}
switch(m)
{
case 0:
printf("\n + \n\n");
break;
case 1:
printf("\n = \n\n");
break;
case 2:
break;
}
}
getch();
return 0;
}